
 
 F u n c t i o n :   n e x t S i b l i n g ( d o m E l e m e n t O r S t r i n g M a r k u p O r C S S S e l e c t o r ,   f u n c t i o n C o n f i r m ( d o m E l e m e n t ) ) 
 
 
 
 S h o r t h a n d :   n e x t ( d o m E l e m e n t O r S t r i n g M a r k u p O r C S S S e l e c t o r ,   f u n c t i o n C o n f i r m ( d o m E l e m e n t ) ) 
 
 
 
 D e s c r i p t i o n :   R e t u r n s   t h e   n e x t   s i b l i n g   e l e m e n t . 
 
 
 
 R e t u r n s :   d o m E l e m e n t ,   o r   $ A   o b j e c t   i f   c h a i n e d . 
 
 
 
 N o t e :   W h e n   t h e   s e c o n d   p a r a m e t e r   i s   u n d e f i n e d ,   n e x t S i b l i n g ( )   r e t u r n s   t h e   n e x t   s i b l i n g   D O M   e l e m e n t .   W h e n   t h e   s e c o n d   p a r a m e t e r   i s   s e t   t o   a   f u n c t i o n   h o w e v e r ,   i t   m u s t   r e t u r n   t r u e   i n   o r d e r   f o r   t h e   c u r r e n t   n o d e   t o   b e   r e t u r n e d .   T h i s   e x i s t s   f o r   c a s e s   w h e n   s p e c i f i c   c r i t e r i a   a r e   n e e d e d ,   s u c h   a s   a   m a t c h i n g   t a g   n a m e   o r   e l e m e n t   t y p e . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   R e t u r n   t h e   n e x t   s i b l i n g   D O M   e l e m e n t . 
 
 v a r   m y E l e m e n t   =   $ A . n e x t S i b l i n g ( d o m E l e m e n t ) ; 
 
 
 
 / /   R e t u r n   t h e   n e x t   s i b l i n g   D O M   e l e m e n t ,   b u t   o n l y   w h e n   s p e c i f i c   c r i t e r i a   i s   c o n f i r m e d . 
 
 v a r   m y E l e m e n t   =   $ A . n e x t S i b l i n g ( d o m E l e m e n t ,   f u n c t i o n ( n o d e )   { 
 
     i f   ( n o d e . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " h 2 " ) 
 
         r e t u r n   t r u e ; 
 
 } ) ; 
 
 
 
 / /   O r   t h e   s a m e   u s i n g   c h a i n i n g 
 
 
 
 / /   R e t u r n   t h e   n e x t   s i b l i n g   D O M   e l e m e n t . 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . n e x t S i b l i n g ( ) ; 
 
 
 
 / /   R e t u r n   t h e   n e x t   s i b l i n g   D O M   e l e m e n t ,   b u t   o n l y   w h e n   s p e c i f i c   c r i t e r i a   i s   c o n f i r m e d . 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . n e x t S i b l i n g ( f u n c t i o n ( n o d e )   { 
 
     i f   ( n o d e . n o d e N a m e . t o L o w e r C a s e ( )   = = =   " h 2 " ) 
 
         r e t u r n   t r u e ; 
 
 } ) ; 
 
 
 
 / /   T o   r e t u r n   t h e   m o d i f i e d   e l e m e n t   w i t h i n   a   c h a i n ,   u s e   t h e   " r e t u r n ( ) "   m e t h o d . 
 
 
 
 v a r   m y E l e m e n t   =   m y C h a i n . r e t u r n ( ) ; 
 
 